#pragma once
#include "richwriter.h"

class CRTFWriter :
	public CRichWriter
{
public:
	CRTFWriter(void):LastFont(0),bInTable(FALSE){}
	virtual ~CRTFWriter(void){}
	virtual void StartDocument(RichLanguage Lang);
	virtual void StartDocHeader(CStringA Title, CStringA Author);
	virtual void StartFontTable();
	virtual void AddFont(FontFamily Family, CStringA Face
		,int Charset = -1, int Codepage = -1);
	virtual void EndFontTable();
	virtual void StartColorTable();
	virtual void AddColor(int Red, int Green, int Blue);
	virtual void EndColorTable();
	virtual void EndDocHeader();
	virtual void StartHeader();
	virtual void EndHeader();
	virtual void StartFooter();
	virtual void EndFooter();
	virtual void AddPageNumber();
	virtual void StartParagraph(RichLanguage Lang = English, RichJust Just = Left);
	virtual void StartFootnote();
	virtual void EndFootnote();
	virtual void SetLang(RichLanguage Lang);
	virtual void SetFont(int n);
	virtual void SetSize(int n);//In half points, default is 24.
	virtual void SetColor(int n);
	virtual void SetBold(BOOL bBold);
	virtual void SetUnderline(BOOL bUnderline);
	virtual void AddChar(char chr);
	virtual void AddUnicodeChar(WCHAR chr);
	virtual void AddTab();
	virtual void AddHardSpace();
	virtual void EndParagraph();
	virtual void StartTable();
	virtual void StartTableDef();
	virtual void DefCell(int twpWidth);
	virtual void EndTableDef();
	virtual void StartRow();
	virtual void StartCell();
	virtual void EndCell();
	virtual void EndRow();
	virtual void EndTable();
	virtual void SetPageNumber(int n);
	virtual void PageAdvance();
	virtual void EndDocument();

protected:
	static CStringA RTFFontFamily[];
	static char JstChar[];
	int LastFont;
	int RowWidth;
	BOOL bInTable;
	RichLanguage StateLang;
};
